package com.whcoding.easypoi.handler;

import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl;
import cn.hutool.core.util.StrUtil;
import com.whcoding.easypoi.vo.OrmDeptExcelVO;

/**
 * @program: spring-boot-learning
 * @description:自定义字段处理
 * @author: whcoding
 * @create: 2022-06-28 19:18
 **/
public class DeptExcelDataHandler extends ExcelDataHandlerDefaultImpl<OrmDeptExcelVO> {

	@Override
	public Object exportHandler(OrmDeptExcelVO obj, String name, Object value) {
		if ("部门类型".equals(name)) {
			String emptyValue = "暂未设置";
			if (value == null) {
				return super.exportHandler(obj, name, emptyValue);
			}
			if (value instanceof String && StrUtil.isBlank((String) value)) {
				return super.exportHandler(obj, name, emptyValue);
			}
		}
		return super.exportHandler(obj, name, value);
	}

	@Override
	public Object importHandler(OrmDeptExcelVO obj, String name, Object value) {
		return super.importHandler(obj, name, value);
	}
}
